package com.xiye.common.util;

import com.xiye.common.controller.BaseController;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author 西野
 * @version V1.0
 * @title PublicUtil.java
 * @package com.xiye.common.util
 * @description IP处理
 * @date 2018-07-12
 */
public class PublicUtil extends BaseController {

    public static String getPorjectPath() {
        String nowpath = "";
        nowpath = System.getProperty("user.dir") + "/";

        return nowpath;
    }

    /*
     * @Author 西野
     * @Date 2018-07-23 16:31:42
     * @Description 获取本机访问地址
     * @Param []
     * @Return java.lang.String
     */  
    public String getIp() {
        String ip = "";
        try {
            InetAddress inet = InetAddress.getLocalHost();
            ip = inet.getHostAddress();
            // System.out.println("本机的ip=" + ip);
        } catch (UnknownHostException e) {
            logger.error(e.toString(), e);
        }

        return ip;
    }

}
